namespace BeerScanOTron_Barcode
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Entity.Spatial;

    [Table("Drinker")]
    public partial class Drinker : INotifyPropertyChanged
    {
        // Declare the PropertyChanged event.
        public event PropertyChangedEventHandler PropertyChanged;

        private string _cardId;
        private string _firstName;
        private string _lastName;

        public Drinker() { }

        public Drinker(string cardId)
        {
            _cardId = cardId;
        }

        [Key]
        public int Id { get; set; }

        [Required]
        [StringLength(150)]
        public string CardId
        {
            get { return _cardId; }
            set
            {
                _cardId = value;
                NotifyPropertyChanged("CardId");
            }
        }

        [StringLength(150)]
        public string FirstName
        {
            get { return _firstName; }
            set
            {
                _firstName = value;
                NotifyPropertyChanged("FirstName");
            }
        }

        [StringLength(150)]
        public string LastName
        {
            get { return _lastName; }
            set
            {
                _lastName = value;
                NotifyPropertyChanged("LastName");
            }
        }

        // Implement INotifyPropertyChanged.
        public void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public void Update()
        {
            NotifyPropertyChanged("CardId");
            NotifyPropertyChanged("FirstName");
            NotifyPropertyChanged("LastName");
        }
    }
}
